﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DocuServe.Core.Entities
{
    public abstract class CmsAttribute : BaseEntity
    {
        public virtual string Description { get; set; }
        public virtual string Name { get; set; }
        public virtual DataType Type { get; protected set; }

        public static CmsAttribute Create(DataType dataType)
        {
            switch (dataType)
            {
                case DataType.NotSet:
                    return null;
                case DataType.Currency:
                    return new CurrencyCmsAttribute();
                case DataType.DateTime:
                    return new DateTimeCmsAttribute();
                case DataType.Numeric:
                    return new NumericCmsAttribute();
                case DataType.Text:
                    return new TextCmsAttribute();
                case DataType.YesNo:
                    return new YesNoCmsAttribute();
                default:
                    throw new ArgumentException(string.Format("No CmsAttribute subclass defined for {0}", dataType), "dataType");
            }
        }
    }
}
